package com.ithe.system.controller;

import com.ithe.core.result.Result;
import com.ithe.system.pojo.LoginDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by zxd on 2022/5/10
 */
@Controller
@ResponseBody
@Api(tags = {"登录相关接口"})
@RequestMapping("/admin-api/v1/admin")
public class AdminController {


    @RequestMapping(value = "/login",method = RequestMethod.POST)
    @ApiOperation(value = "登录",notes = "登录",httpMethod = "POST")
    @ApiResponses({
            @ApiResponse(code = 200, message = "服务器返回token令牌，请各端自行存储token令牌，并在其它请求(请求头或请求参数)中携带token令牌"),
    })
    public Result login(@RequestBody LoginDto loginDto){

        return Result.success("token:sacsasvdsvsdavnsnsdvdvd");
    }


    @RequestMapping(value = "/info",method = RequestMethod.GET)
    public Result info(){

        //TODO  根据查询的信息返回数据给前端

        return Result.success("{\n" +
                "    \"roles\": [\"system\"],\n" +
                "    \"introduction\": \"I am a super administrator\",\n" +
                "    \"avatar\": \"https://baby-1301829950.cos.ap-chengdu.myqcloud.com/xxx/47311627959301869.jpg\",\n" +
                "    \"name\": \"奥利给\"\n" +
                "  }");
    }



}
